<template>
  <div class="member" :style="memberstyle">
    <div class="sign_btn" v-if="data.sign.show" :style="'background:' + data.sign.bg_color + ';color:' + data.sign.text_color">
      <i class="el-sc-riqi3"></i>
      <span>签到赚金币</span>
    </div>
    <div class="top">
      <div :class="data.avart_type == 2 ? 'img-box radius' : 'img-box'"><img src="@/assets/images/nologin.jpg" class="avart" draggable="false" /></div>
      <div class="body">
        <p class="username" :style="'color:' + data.namecolor">登录/注册</p>
        <p class="level"><span class="levelname">ID:86578954</span></p>
      </div>
    </div>
    <div class="btns" v-if="data.finance.btns.length > 0">
      <template v-for="(item, i) in data.finance.btns">
        <div :class="data.finance.btns.length - 1 == i ? 'btn' : 'btn yue'" :style="'border-color:' + data.finance.linecolor">
          <p class="num" :style="'color: ' + data.finance.numcolor">0</p>
          <p class="content" :style="'color: ' + data.finance.titlecolor">{{ finance[item] }}</p>
        </div>
      </template>
    </div>
    <div class="order_btns" v-if="data.btn.show">
      <div class="order_item" v-for="(item, i) in data.list" :key="i">
        <i :style="'color:' + data.btn.icon_color" :class="item.icon"></i>
        <span :style="'color:' + data.btn.text_color">{{ item.text }}</span>
      </div>
    </div>
  </div>
</template>

<script>
import {mapState} from 'vuex';
import {mapGetters} from 'vuex';
export default {
  props: {
    data: {
      type: Object,
      default: {}
    }
  },
  data() {
    return {
      finance: ['余额', '积分', '优惠券']
    };
  },
  computed: {
    memberstyle() {
      return 'background:' + (this.data.bg_type == 1 ? this.data.bg : this.data.imgbg ? 'url(' + this.picurl + '/' + this.data.imgbg + ')' : this.data.bg) + ';';
    },
    ...mapGetters(['picurl'])
  }
};
</script>

<style lang="scss">
.member {
  width: 375px;
  margin: 0 auto;
  position: relative;
  background: #ff3c29;
  overflow: hidden;
  background-size: contain !important;
  background-repeat: no-repeat !important;
  padding-bottom: 10px;
  .top {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-wrap: nowrap;
    position: relative;
    z-index: 1;
    padding: 16px 12px 24px;
  }
  .sign_btn {
    position: absolute;
    top: 35px;
    right: 0;
    width: 111px;
    height: 35px;
    background: #eb4521;
    border-radius: 17px 0px 0px 17px;
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #ffffff;
    i {
      margin: 0 6px 0 9px;
    }
  }
  .img-box {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    overflow: hidden;
    box-sizing: border-box;
    border: 0.5px solid #e6e7eb;
    margin-right: 20px;
    border-radius: 50%;

    &.radius {
      border-radius: 6px;
    }

    .avart {
      width: 100%;
      height: 100%;
    }
  }

  .body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    flex: 1;
    font-family: PingFang SC;
    font-style: normal;

    p {
      margin: 0;
    }

    .username {
      font-size: 16px;
      line-height: 16px;
      padding: 3px 0;
      font-weight: bold;
    }

    .level {
      margin-top: 12px;
      font-size: 13px;
      line-height: 26px;
      // padding: 2px 6px 2px 4px;
      width: 100px;
      height: 26px;
      background: rgba(255, 255, 255, 0.4);
      // opacity: 0.4;
      border-radius: 13px;
      color: #ffffff;
      text-align: center;
      display: inline-block;
      .levelname {
        vertical-align: 1px;
        display: inline-block;
        opacity: 1;
      }
    }
  }

  .icon-right {
    -ms-flex-negative: 0;
    flex-shrink: 0;
    font-size: 20px;
    width: 20px;
    height: 20px;
    text-align: center;
    line-height: 20px;
    margin: auto 0;
  }

  .btns {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-wrap: nowrap;
    position: relative;
    z-index: 1;

    font-family: PingFang SC;
    font-style: normal;
    margin-bottom: 20px;
    .btn {
      width: 0;
      flex: 1;
      display: flex;
      flex-direction: column;
      text-align: center;
      margin: 0;
      justify-content: space-between;
      padding-top: -4px;

      .num {
        font-weight: bold;
        font-size: 18px;
        line-height: 12px;
        margin: 0 auto 15px;
      }

      .content {
        font-size: 12px;
        line-height: 12px;
        margin: 0 auto 0;
      }
    }

    .yue {
      // border-right: 0.5px solid #fff;
    }
  }
}
.order_btns {
  width: 348px;
  height: 92px;
  background: #ffffff;
  // box-shadow: 0px 4px 5px 0px rgba(0, 0, 0, 0.18);
  border-radius: 10px;
  display: flex;
  align-items: center;
  margin: 0 auto;
  .order_item {
    display: flex;
    align-items: center;
    flex-direction: column;
    flex: 1;
    span {
      font-size: 12px;
      margin-top: 10px;
      font-weight: bold;
    }
    i {
      font-size: 30px;
    }
  }
}
</style>
